/*
Sail.onStart = function () {
    // Laya.DebugPanel.init() //Laya调试工具
    Laya.Stat.show();
    // Laya.Stat.enable(); //汽车跑动动画需要激活性能统计功能来获取游戏当前的fps

    Laya.SoundManager.setMusicVolume(0.4);
    Laya.Font.defaultFamily = "Microsoft Yahei";
    Laya.Font.defaultFont = "12px 'Microsoft Yahei'";;
    Laya.SoundManager.autoStopMusic = false;
    Laya.SoundManager.autoReleaseSound = false;

    Sail.keyboard = new Tools.KeyBoardNumber;

    // $(".btn-login").on("click", function () {
    //     location.href = GM.userLoginUrl;
    // });
    $(".btn-enter").on("click", function () {
        $(this).hide();
        if (GM.debug) {
            let data = {"cmd":"enter","code":0,"res":{"player":[[{"uid":2037610954,"icon":"1","lv":2,"tno":"61374560","ue":"rew","mid":2,"um":5,"lr":1,"avg":5,"e":1,"pos":0,"st":1,"ho":"2","gd":"1","hn":"瑞恩","hl":1,"hm":0,"offplay":0,"bt":0,"maxhp":1000,"hp":1000,"w":160,"h":180,"s":700,"m":0,"d":0,"status":1,"ki":0,"di":0,"sc":2,"exp":530,"ul":11,"ugd":"青铜1","tsc":0,"clip":{"max":3,"t":5000,"p":{"x":-15,"y":-15,"x1":114,"y1":-64},"s":2000,"n":5,"b":200,"cnt":3},"bullet":{"t":2,"s":800,"g":800,"hb":0,"o":0,"d":{"h":100,"t":500,"r":10},"i":{"h":100,"t":500,"r":10},"b":{"h":100,"t":500,"r":10}},"skill":{"et":400,"ec":0,"n":10,"bt":200,"hb":1,"o":1,"nt":5,"nc":0,"d":{"h":100,"t":2000,"r":10},"i":{"h":100,"t":2000,"r":10},"b":{"h":100,"t":2000,"r":10}},"camp":"red","x":72,"y":792,"mx":1,"my":0,"rno":"cb4128f49d"}],[{"uid":2037586642,"icon":"1","lv":0,"tno":"61379422","ue":"abc","mid":2,"um":85,"lr":1,"avg":100,"e":1,"pos":0,"st":1,"ho":"1","gd":"2","hn":"瑞恩","hl":1,"hm":15,"offplay":0,"bt":0,"maxhp":1000,"hp":1000,"w":120,"h":186,"s":700,"m":0,"d":0,"status":1,"ki":0,"di":0,"sc":2,"exp":600,"ul":11,"ugd":"青铜1","tsc":0,"clip":{"max":3,"t":5000,"p":{"x":-20,"y":-34,"x1":84,"y1":-56},"s":2000,"n":5,"b":200,"cnt":3},"bullet":{"t":1,"s":1200,"g":1200,"hb":0,"o":0,"d":{"h":100,"t":1000,"r":10},"i":{"h":100,"t":1000,"r":10},"b":{"h":100,"t":1000,"r":10}},"skill":{"et":400,"ec":0,"n":10,"bt":200,"hb":0,"o":1,"nt":5,"nc":0,"d":{"h":100,"t":2000,"r":10},"i":{"h":100,"t":2000,"r":10},"b":{"h":100,"t":2000,"r":10}},"camp":"blue","x":4968,"y":792,"mx":-1,"my":0,"rno":"cb4128f49d"}]],"tips":"匹配成功，开始加载","roomNo":"cb4128f49d"}};
            Sail.io.publish(data.cmd, data.res, data.code);
            return;
        }
        Sail.io.emit("match", { "heroNo":"1","mapId":2,"type":2});
    });
    if (!GM.userLogged) {
        $(".btn-login").show();
    } else {
        // Sail.io.register("io.close", null, function () {
        //     setTimeout(function () {
        //         location.reload();
        //     }, 1000);
        // });
        Sail.io.register({
            "io.open": () => { $(".btn-enter").show(); },
            "enter": startGame
        }, this);

        if (!GM.debug) {
            Sail.io.init(IO_CONFIG);
        } else {
            Sail.io.publish('io.open');
        }
    }

    var game = null;

    function startGame(data, code, errMsg) {
        if (code != 0) {
            $(".btn-enter").show();
            return;
        }
        Sail.io.unregister('enter', this);
        $(".btn-enter").hide();
        Laya.loader.load(ASSETS.GAME, Laya.Handler.create(null, function () {
            if(!game){
                game = new Scene.Game();   
            }
            game.init(data);
            Sail.director.runScene(game);
        }));
    }
}
Sail.run(GAME_CONFIG);
*/
Sail.onStart = function () {
    // Laya.DebugPanel.init() //Laya调试工具
    // Laya.Stat.show();

    Laya.SoundManager.setMusicVolume(0.4);
    Laya.Font.defaultFamily = "Microsoft Yahei";
    Laya.Font.defaultFont = "12px 'Microsoft Yahei'";;
    Laya.SoundManager.autoStopMusic = false;
    Laya.SoundManager.autoReleaseSound = false;

    Sail.keyboard = new Tools.KeyBoardNumber;

    Sail.io.init(IO_CONFIG);
    // Laya.loader.load(ASSETS.HALL, Laya.Handler.create(null, function () {
    //     Sail.director.runScene(new Scene.Hall);
    // }));
    Sail.director.runScene(new Scene.Start);
}
Sail.run(GAME_CONFIG);


//http://76test42-wap.stg3.1768.com/?act=game_deepseaglory&debug_status=1